package cn.xinfei.xdecision.xxl;

import cn.xinfei.xdecision.listener.IXListener;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.event.ApplicationReadyEvent;

@Slf4j
//@Service
public class XXLJobDelayRegister implements IXListener {
    @Override
    public String eventName() {
        return ApplicationReadyEvent.class.getSimpleName();
    }

    @Override
    public void after() {
//        log.info(">>>>>>>>>>> xxl-job register start.");
//        ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
//        executor.schedule(() -> {
//            try {
//                XxlJobConfig bean = ApplicationContextUtil.getBean(XxlJobConfig.class);
//                log.info(">>>>>>>>>>> xxl-job config={}", JSONObject.toJSONString(bean));
//                XxlJobSpringExecutor xxlJobSpringExecutor = ApplicationContextUtil.getBean(XxlJobSpringExecutor.class);
//                xxlJobSpringExecutor.afterSingletonsInstantiated();
//                log.info(">>>>>>>>>>> xxl-job executor={}", JSONObject.toJSONString(xxlJobSpringExecutor));
//                log.info(">>>>>>>>>>> xxl-job register end.");
//            } catch (Exception e) {
//                log.info(" nacos delay register error.", e);
//            }
//        }, 2000, TimeUnit.MILLISECONDS);
    }
}
